<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<!-- Website template by freewebsitetemplates.com -->
<html>
     
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>Grade Bay</title>
		<link rel="stylesheet" href="gui.css" type="text/css" />
		<!--[if IE 7]>
			<link rel="stylesheet" href="css/ie7.css" type="text/css" />
		<![endif]-->
                
                <script type="text/javascript" src="jquery-latest.pack.js"></script> 
     <script type="text/javascript" src="javascript.js"></script>
     <script type="text/javascript">
         function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
function addInput1stQuarter()
{
	var x = document.getElementById("1stQuarter");
	x.innerHTML += "<tr><td><p>Name: <input class='tf_effect' type='text' name='criteria[]'/></p></td>   <td><p>Percentage:</p></td> <td><input class='tf_effect' type='text'onkeypress='return isNumberKey(event)' maxlength='3'name='critPercent[]'/></td></tr>";
}
function addInput2ndQuarter()
{
	var x = document.getElementById("2ndQuarter");
	x.innerHTML += "<tr><td><p>Name: <input class='tf_effect' type='text' name='criteria1[]'/></p></td>   <td><p>Percentage:</p></td> <td><input class='tf_effect' type='text' onkeypress='return isNumberKey(event)' maxlength='3' name='critPercent1[]'/></td></tr>";
}
function addInput3rdQuarter()
{
	var x = document.getElementById("3rdQuarter");
	x.innerHTML += "<tr><td><p>Name: <input class='tf_effect' type='text' name='criteria2[]'/></p></td>   <td><p>Percentage:</p></td> <td><input class='tf_effect' type='text' onkeypress='return isNumberKey(event)' maxlength='3' name='critPercent2[]'/></td></tr>";
}
function addInput4thQuarter()
{
	var x = document.getElementById("4thQuarter");
	x.innerHTML += "<tr><td><p>Name: <input class='tf_effect' type='text' name='criteria3[]'/></p></td>   <td><p>Percentage:</p></td> <td><input class='tf_effect' type='text' onkeypress='return isNumberKey(event)' maxlength='3' name='critPercent3[]'/></td></tr>";
}
</script>
	</head>
	<body>
		<div class="page">
			<div class="header">
				<a href="index.php" id="logo"><img src="images/gradeBaylogo.png" width="330" height="79" alt=""/></a>
				<ul>
					<li class="selected"><a href="">ADD SUBJECT</a></li>
					<li><a href="index.php">HOME</a></li>
					<li><a href="create.php">BACK</a></li>
				</ul>
			</div>
			<div class="body">
                            <div class="addsubject">
<?php
    include 'PHPClasses/DBAccess.php';
    include 'PHPClasses/Subject.php';
    include 'PHPClasses/GradeCriterion.php';
    include 'PHPClasses/SubjectDBAccess.php';

    //error_reporting (E_ALL ^ E_NOTICE);
    
    
   
    
     if(!isset($_GET['error'])){
         $_GET['error']=0;
     }
    
     if ($_GET['error']){ //If any errors display them  
               
           $errormsg = $_GET['error'] . ".<br>";
           echo "<p style='color:red;'>$errormsg</p>";
           
     }
     
   
     
 ?>
					<form action="addSubjectDB.php" method="post">
                                         <table>
                                            <tr><td><p>Name of Subject:</p></td><td><input class='tf_effect' type="text" name="subjName" /></td></tr>
                                            <tr><td><p>Passing Grade of Subject:</p></td><td><input onkeypress='validate(event)' onkeypress='return isNumberKey(event)' maxlength='2'class='tf_effect' type="text" name="passing" maxlength="2"/></td></tr>
                                            <tr><td><p>For Year Level:</p></td><td>  <p>  <input type="checkbox" type="text" name="level[]" value="Grade 1"/> Grade 1
                                                    <input type="checkbox" type="text" name="level[]" value="Grade 2"/> Grade 2
                                                    <input type="checkbox" type="text" name="level[]" value="Grade 3"/> Grade 3
                                                    <input type="checkbox" type="text" name="level[]" value="Grade 4"/> Grade 4
                                                    <input type="checkbox" type="text" name="level[]" value="Grade 5"/> Grade 5
                                                    <input type="checkbox" type="text" name="level[]" value="Grade 6"/> Grade 6<br/>
                                                    <input type="checkbox" type="text" name="level[]" value="1st Year"/> 1st Year
                                                    <input type="checkbox" type="text" name="level[]" value="2nd Year"/> 2nd Year
                                                    <input type="checkbox" type="text" name="level[]" value="3rd Year"/> 3rd Year
                                                    <input type="checkbox" type="text" name="level[]" value="4th Year"/> 4th Year </td></tr>
                                            
                                                  
                                            <?php
                                             include 'PHPClasses/TeacherDBAccess.php';
                                            
                                            $DBAccess=new TeacherDBAccess();
                                            
                                            
                                            $teachers = mysql_query("SELECT * FROM teacher")
                                                                                            or  die('Could not connect: ' . mysql_error());  
                                            
                                         
                                                  echo"  <tr><td><p>Teacher in Charge:</p></td> 
                                                         <td><select name='teacher'>";
                                             
                                                  while($row = mysql_fetch_array($teachers)){
                                                      
                                                    extract($row);
                                                            
                                                    echo "<option value='$idTeacher'>$teacherName</option><br/>";
                                                    
                                                  
                                            }
                                                              
                                            echo "</select> </td></tr></table><br/><br/>";
                                                        
                                           $DBAccess->DBDisconnect();
                                                    
                                            ?>
                                            
                                         <table id="1stQuarter">
                                            <tr><td><p>Grade Criteria For 1st Quarter:</p></td></tr>
                                                <tr><td><input type="button" class="addmore" onmousedown="addInput1stQuarter();" value="Add More Criteria" /></td></tr>
                                                <tr><td><p>Name: <input class='tf_effect' type="text" name="criteria[]" value="Exams"/></p></td>   <td><p>Percentage:</p></td> <td><input class='tf_effect' type="text" onkeypress='return isNumberKey(event)' maxlength='3' name="critPercent[]" value="100"/></td></tr>
                                         </table>   
                                            <table id="2ndQuarter">
                                            <tr><td><p>Grade Criteria For 2nd Quarter:</p></td></tr>
                                                <tr><td><input type="button" class="addmore" onmousedown="addInput2ndQuarter();" value="Add More Criteria"/></td></tr>
                                                <tr><td><p>Name: <input class='tf_effect' type="text" name="criteria1[]" value="Exams"/></p></td>   <td><p>Percentage:</p></td> <td><input class='tf_effect' type="text" onkeypress='return isNumberKey(event)' maxlength='3' name="critPercent1[]" value="100"/></td></tr>
                                               
                                         </table>   
                                            <table id="3rdQuarter">
                                            <tr><td><p>Grade Criteria For 3rd Quarter:</p></td></tr>
                                            <tr><td><input type="button"  class="addmore" onmousedown="addInput3rdQuarter();" value="Add More Criteria"/></td></tr>
                                                <tr><td><p>Name: <input class='tf_effect' type="text" name="criteria2[]" value="Exams"/></p></td>   <td><p>Percentage:</p></td> <td><input class='tf_effect' type="text" onkeypress='return isNumberKey(event)' maxlength='3' name="critPercent2[]" value="100"/></td></tr>
                                             
                                         </table>   
                                              <table id="4thQuarter">
                                            <tr><td><p>Grade Criteria For 4th Quarter:</p></td></tr>
                                              <tr><td><input type="button"  class="addmore" onmousedown="addInput4thQuarter();" value="Add More Criteria"/></td></tr>
                                              <tr><td><p>Name:   <input class='tf_effect' type="text" name="criteria3[]" value="Exams"/></p></td>   <td><p>Percentage:</p></td> <td><input class='tf_effect' type="text" onkeypress='return isNumberKey(event)' maxlength='3' name="critPercent3[]" value="100"/></td></tr>
                                                
                                            
                                         </table>   
                                            <br/><br/><center><input type="submit" id="addbutton" class="addmore" value="Add Subject" name="addSubject" /></center>
                                            <input type="hidden" name="submitted" value="1">
                                         </form>
				
				
                            </div>
			</div>
			<div class="footer">
				
				<p>&#169; Copyright &#169; 2011. Company name all rights reserved</p>
				<div class="connect">
					<a href=""><img src="images/paragox.png" width=160" height="110" alt=""/></a>
					<a href=""><img src="images/fblogo.png" width=120" height="100" alt="" style="position:relative; left:-31px"/></a>
					<a href=""><img src="images/harmony.png" width=120" height="100" alt="" style="position:relative; left:0px"/></a>
				</div>
			</div>
		</div>
	</body>
</html>  